<template>
	<view class="flex-col homepage">
		<view class="flex-col wrapper">
			<view class="flex-row wraper-row">
				<view class="box"></view>
				<view class="u-line-1 text">车辆信息</view>
				
				<view class="u-line-1 text-two" v-if="VehicleCar.monthCardState=='否'" @click="byMonthCar()">购买月卡</view>
				<view class="u-line-1 text-two" v-if="VehicleCar.monthCardState=='是'" >已购买月卡</view>
			</view>
			<view class="wraper-row-two">
				<view class="u-line-1 text-three">{{VehicleCar.vehicleNumber}}</view>
				<view class="u-line-1 text-four">车牌号</view>
			</view>
			<view class="flex-row wraper-row-three">
				<view class="u-line-1 text-five">车辆品牌</view>
				<view class="u-line-1 text-six">{{VehicleCar.vehicleBrand}}</view>
			</view>
			<view class="flex-row wraper-row-four">
				<view class="u-line-1 text-seven">车辆型号</view>
				<view class="u-line-1 text-eight">{{VehicleCar.vehicleModel}}</view>
			</view>
			<view class="wraper-row-five">
				<view class="u-line-1 text-nine">{{VehicleCar.vehicleColor}}</view>
				<view class="u-line-1 text-ten">车身颜色</view>
			</view>
			<view class="u-line-1 text-eleven">车辆图片</view>
			<view class="wraper-row-six">
				<u--image :showLoading="true" :src="VehicleCar.file" width="312px" height="142px" @click="click">
				</u--image>
			</view>
			<view class="wraper-row-seven"></view>
		</view>
		<view class="flex-row wrapper-two">
			<u-button class="button" type="error" size="medium" @click="xiugaicar()">
				修改
			</u-button>
			<u-button class="button-two" @click="shanchucar()">
				删除
			</u-button>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				VehicleCar: {}
			}
		},
		onLoad(option) {
			//获取到车辆详情
			const editItem = JSON.parse(decodeURIComponent(option.data));
			this.VehicleCar = editItem
			console.log(this.VehicleCar)
		},
		methods: {
			xiugaicar() {
				uni.navigateTo({
					url: 'UpdateVehicle?data=' + encodeURIComponent(JSON.stringify(this.VehicleCar)),
					success: function(res) {}
				})
			},
			shanchucar(){
				this.$axios({
					url: 'serverwg/WjxDeleteVehicleCar',
					data:this.VehicleCar,
					method: 'Post',
					success: (res) => {
						if(res.data.code==2000){
							uni.navigateTo({
								url: './Myvehicle',
								success: function(res) {}
							})
						}else if(res.data.code==5000){
							alert("添加失败")
						}
					}
				})
			},
			byMonthCar(){
				uni.navigateTo({
					url: 'Vehiclemonthlycard?data=' + encodeURIComponent(JSON.stringify(this.VehicleCar)),
					success: function(res) {}
				})
				// this.$axios({
				// 	url: 'serverwg/byMonthCar',
				// 	data:this.VehicleCar,
				// 	method: 'Post',
				// 	success: (res) => {
				// 		if(res.data.code==2000){
				// 			uni.navigateTo({
				// 				url: './Myvehicle',
				// 				success: function(res) {}
				// 			})
				// 		}else if(res.data.code==5000){
				// 			alert("添加失败")
				// 		}
				// 	}
				// })
			}

		}
	}
</script>
<style lang="scss" scoped>
	/** 全局样式-开始,建议放在公共css样式文件中,比如common.css 或app.vue文件 */

	html,
	body {
		margin: 0;
		width: 100%;
		height: 100%;
		font-size: 16px
	}

	view,
	text,
	image {
		position: relative;
		box-sizing: border-box;
		flex-shrink: 0;
	}

	.flex-col {
		display: flex;
		align-items: flex-start;
		flex-direction: column;
	}

	.flex-row {
		display: flex;
		align-items: flex-start;
	}

	.flex-col .flex-row {
		width: 100%
	}

	/** 全局样式-结束*/

	.homepage {
		padding: 50rpx 0rpx 52rpx 28rpx;

		.wrapper {
			width: 702rpx;
			margin: 0rpx 0rpx 260rpx 4rpx;
			padding: 34rpx 0rpx 42rpx 27rpx;
			border-width: 2rpx;
			border-style: solid;
			border-color: rgba(221, 221, 221, 1);

			.wraper-row {
				width: 647rpx;
				margin-bottom: 22rpx;

				.box {
					width: 16rpx;
					height: 34rpx;
					margin: 6rpx 20rpx 0rpx 0rpx;
					border-radius: 100rpx;
					background: rgba(11, 84, 242, 1);
				}

				.text {
					width: 218rpx;
					margin-right: 260rpx;
					font-size: 32rpx;
					font-weight: 600;
					color: rgba(130, 130, 130, 1);
				}

				.text-two {
					width: 132rpx;
					height: 36rpx;
					font-size: 30rpx;
					font-weight: 700;
					color: rgba(93, 139, 255, 1);
				}
			}

			.wraper-row-two {
				width: 640rpx;
				padding: 49rpx 0rpx 31rpx 149rpx;
				border-top-color: rgba(226, 226, 226, 1);
				border-bottom-color: rgba(226, 226, 226, 1);

				.text-three {
					width: 194rpx;
					font-size: 30rpx;
					font-weight: 600;
					color: rgba(85, 85, 85, 1);
				}

				.text-four {
					width: 134rpx;
					bottom: 36rpx;
					left: 0rpx;
					font-size: 28rpx;
					position: absolute;
					font-weight: 700;
					color: rgba(173, 173, 173, 1);
				}
			}

			.wraper-row-three {
				width: 640rpx;
				justify-content: space-between;
				padding: 38rpx 287rpx 38rpx 0rpx;
				border-top-width: 2rpx;
				border-top-style: solid;
				border-top-color: rgba(226, 226, 226, 1);
				border-bottom-width: 2rpx;
				border-bottom-style: solid;
				border-bottom-color: rgba(226, 226, 226, 1);

				.text-five {
					width: 134rpx;
					font-size: 28rpx;
					font-weight: 700;
					color: rgba(173, 173, 173, 1);
				}

				.text-six {
					width: 194rpx;
					font-size: 30rpx;
					font-weight: 600;
					color: rgba(85, 85, 85, 1);
				}
			}

			.wraper-row-four {
				width: 640rpx;
				justify-content: space-between;
				padding: 39rpx 298rpx 39rpx 0rpx;
				border-top-color: rgba(226, 226, 226, 1);
				border-bottom-width: 2rpx;
				border-bottom-style: solid;
				border-bottom-color: rgba(226, 226, 226, 1);

				.text-seven {
					width: 134rpx;
					font-size: 28rpx;
					font-weight: 700;
					color: rgba(173, 173, 173, 1);
				}

				.text-eight {
					width: 194rpx;
					font-size: 30rpx;
					font-weight: 600;
					color: rgba(85, 85, 85, 1);
				}
			}

			.wraper-row-five {
				width: 640rpx;
				margin-bottom: 28rpx;
				padding: 35rpx 0rpx 43rpx 154rpx;
				border-top-color: rgba(226, 226, 226, 1);
				border-bottom-width: 2rpx;
				border-bottom-style: solid;
				border-bottom-color: rgba(226, 226, 226, 1);

				.text-nine {
					width: 194rpx;
					font-size: 30rpx;
					font-weight: 600;
					color: rgba(85, 85, 85, 1);
				}

				.text-ten {
					width: 134rpx;
					top: 32rpx;
					left: -2rpx;
					font-size: 28rpx;
					position: absolute;
					font-weight: 700;
					color: rgba(173, 173, 173, 1);
				}
			}

			.text-eleven {
				width: 158rpx;
				height: 34rpx;
				margin-bottom: 26rpx;
				font-size: 30rpx;
				font-weight: 600;
				color: rgba(180, 180, 180, 1);
			}

			.wraper-row-six {
				width: 628rpx;
				height: 286rpx;
				margin: 0rpx 0rpx 12rpx 6rpx;
				border-width: 2rpx;
				border-style: solid;
			}

			.wraper-row-seven {
				width: 628rpx;
				height: 286rpx;
				margin-left: 6rpx;
				border-width: 2rpx;
				border-style: solid;
			}
		}

		.wrapper-two {
			width: 706rpx;
			justify-content: space-between;

			.button {
				width: 340rpx;
				height: 78rpx;
				background: rgba(64, 99, 255, 1);
				border: none
			}

			.button-two {
				width: 340rpx;
				height: 78rpx;
				color: rgba(255, 28, 28, 1);
				border: 1px red solid;
			}
		}
	}
</style>
